package com.winenine999.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.winenine999.custom.dao.CSyroleMapper;
import com.winenine999.generator.dao.SyroleMapper;
import com.winenine999.jdbc.dao.SyroleDao;
import com.winenine999.model.Page;
import com.winenine999.model.Syrole;
import com.winenine999.service.ISyroleService;
@Service
public class SyroleService implements ISyroleService {
	@Autowired
	private SyroleMapper syroleMapper; 
	@Autowired
	private CSyroleMapper cSyroleMapper; 
	@Autowired
	private SyroleDao syroleDao;
	@Override
	public List<Syrole> findAllSyroles() {
		// TODO Auto-generated method stub
		return cSyroleMapper.findAllSyroles();
	}
	/**
	 * 根据id删syrole
	 */
	
	@Override
	public int deleteByPrimaryKey(Integer id) {
		
		return syroleMapper.deleteByPrimaryKey(id);
	}
	/**
	 * 选择字段添加syrole
	 */
	@Override
	public int insertSelective(Syrole syrole) {
		
		return syroleMapper.insertSelective(syrole);
	}
	/**
	 * 选择字段修改syrole
	 */
	@Override
	public int updateByPrimaryKeySelective(Syrole syrole) {
		
		return syroleMapper.updateByPrimaryKeySelective(syrole);
	}
	/**
	 * 根据id查询syrole
	 */
	@Override
	public Syrole selectByPrimaryKey(Integer id) {
		
		return syroleMapper.selectByPrimaryKey(id);
	}
	//-------------------------------custom----------------------------------
	/**
	 * 查询该角色拥有和未拥有的角色
	 */
	@Override
	public List<Map<String,Object>> findRoleExistPermissionsAndNotExistPermissions(Integer roleId) {
		
		return cSyroleMapper.findRoleExistPermissionsAndNotExistPermissions(roleId);
	}
	/**
	 * 分页查询角色
	 */
	@Override
	public Page findPageSyrole(Page page) {
		
		return syroleDao.findPageSyrole(page);
	}

}
